var mongoose = require("mongoose");
var dbconn = require("./mongoose");

let bshoplistSchema = new mongoose.Schema({
  "pic":String,
  "pinpai":String,
  "price":String,
  "web":String
});

let bshoplistModel = dbconn.model("bshoplists",bshoplistSchema);

module.exports = {
  //得到所有商品
  "findall":function(cb){
    bshoplistModel.find({},function(err,data){
      if(err){
        console.log("查询失败");
      }else{
        cb(data);
      }
    })
  },
  //查询
  "find":function(paramObj,cb){
    bshoplistModel.find(paramObj,function(err,data){
      if(!err){
        cb(data);
      }
    });
  }
}
